import { createSlice } from '@reduxjs/toolkit';

const userSlice = createSlice({
    name: "user",
    initialState: {
        user:{}
    },
    reducers:{
        setUser(state,action){
            state.user = action.payload;
        }
    }
});
// 将切片自动生成的action导出，生成action的名字和reducer的名字是一样的
export const {setUser} = userSlice.actions;
// 将切片中的reducer导出
export default userSlice.reducer;
